home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 23 / CU Amiga - Super CD-ROM 23 (June 1998).iso / CreatingGames / Utilities / Misc / GMS / GMSDev / Source / C / IceBreaker / IceAssembler.asm next >
Encoding:
Assembly Source File  |  1997-11-11  |  34.6 KB  |  1,238 lines

  1. ;IceBreaker Assembler Source
  2. ;---------------------------
  3. ;Link this file with IceBreaker.c.
  4. ;CASE sensitivity ON.
  5.  
  6.     INCDIR    "INCLUDES:"
  7.     INCLUDE    "exec/exec_lib.i"
  8.     INCLUDE    "dos/gmsdos_lib.i"
  9.     INCLUDE    "libs/graphics_lib.i"
  10.     INCLUDE    "dpkernel/dpkernel.i"
  11.     INCLUDE    "system/debug.i"
  12.     INCLUDE    "system/dpkbase.i"
  13.     INCLUDE    "system/tasks.i"
  14.  
  15.     ;The following values are defined in the C source.
  16.  
  17.     xref    _DOSBase
  18.     xref    _SysBase
  19.     xref    _conhandle
  20.  
  21.     ;The following values are defined by us so that the C source can
  22.     ;access them.
  23.  
  24.     xdef    _libDebugMessage
  25.     xdef    _libErrorMessage
  26.     xdef    _libStepBack
  27.     xdef    _DebugList
  28.     xdef    _GFXBase
  29.     xdef    _DPKBase
  30.     xdef    _maxstep
  31.  
  32.     SECTION    IceAssembler,CODE
  33.  
  34. WText    MACRO        ;Simple macro for nice looking source.
  35.     dc.b    \1,0
  36.     even
  37.     ENDM
  38.  
  39. ;===================================================================================;
  40. ;                             INTERCEPT DEBUG MESSAGE
  41. ;===================================================================================;
  42. ;Function: Receives a debug message, copies it to the buffer and then sends a
  43. ;       message to our main task, which tells it new data has appeared in the
  44. ;       buffer.  This function needs to be very very fast.
  45. ;
  46. ;Requires: d7 = Debug type in low word, flags in high word.
  47. ;       a5 = Message string if type of Error/Formatted/Message.
  48. ;Returns:  Nothing.
  49.  
  50. _libDebugMessage:
  51.     tst.w    InDebug    ;ma = Check if we are in IceBreaker.
  52.     beq.s    .cont    ;>> = Nope, continue as normal.
  53.     MOVEM.L    D0-D1/D7/A0-A1/A6,-(SP)    ;SP = Save registers.
  54.     and.l    #STEP,d7    ;d6 = Step necessary?
  55.     beq.s    .qex    ;>> = Nope.
  56.     move.l    _DPKBase,a6    ;a6 = DPKBase.
  57.     CALL    FindDPKTask    ;>> = Find this task.
  58.     tst.l    d0    ;d0 = Check if the node exists.
  59.     beq.s    .qex    ;>> = No.
  60.     move.l    d0,a0    ;a0 = Pointer to Task node.
  61.     addq.w    #1,GT_DebugStep(a0)    ;a0 = (DebugStep)+1
  62. .qex    MOVEM.L    (SP)+,D0-D1/D7/A0-A1/A6    ;>> = Return registers.
  63.     rts
  64.  
  65. ;-----------------------------------------------------------------------------------;
  66. ;Compare the maxstep and debug step values.
  67.  
  68. .cont    MOVEM.L    D0-D1/D7/A0-A1/A6,-(SP)    ;SP = Save registers.
  69.     move.l    _DPKBase,a6    ;a6 = DPKBase.
  70.     CALL    FindDPKTask    ;>> = Find this task.
  71.     tst.l    d0    ;d0 = Check if the node exists.
  72.     beq.s    .dbg    ;>> = No, continue anyway.
  73.     move.l    d0,a0    ;a0 = Pointer to Task node.
  74.     move.w    _maxstep(pc),d0    ;d0 = Maximum step value.
  75.     cmp.w    GT_DebugStep(a0),d0    ;a0 = Is (MaxStep > GT_DebugStep)?
  76.     bgt.s    .dbg    ;>> = Yes, continue.
  77.     and.l    #STEP,d7    ;d6 = Step necessary?
  78.     beq.s    .cexit    ;>> = Nope.
  79.     addq.w    #1,GT_DebugStep(a0)    ;a0 = (DebugStep)+1
  80. .cexit    MOVEM.L    (SP)+,D0-D1/D7/A0-A1/A6    ;SP = Return registers.
  81.     rts
  82.  
  83. ;-----------------------------------------------------------------------------------;
  84. ;Print the message.
  85.  
  86. .dbg    MOVEM.L    (SP)+,D0-D1/A0-A1/D7/A6    ;SP = Return registers.
  87.  
  88.     cmp.w    #DBG_END,d7    ;d7 = If (Type < 0) or (Type > DBG_End-1)
  89.     bcs.s    .print    ;>> = No, it's safe.
  90.     move.l    d7,d5    ;d5 = Remember bad number.
  91.     and.l    #$0000ffff,d5    ;d5 = Get rid of special flags.
  92.     move.w    #DBG_BadNumber,d7
  93.  
  94. .print    move.w    #1,InDebug    ;ma = We are now in IceBreaker.
  95.     tst.w    gb_BlitterUsed(a6)    ;a6 = Blitter allocated?
  96.     beq.s    .debug    ;>> = No, safe.
  97.  
  98.     MOVEM.L    D0-D1/A0-A1/A6,-(SP)    ;SP = Save registers.
  99.     move.l    _GFXBase(pc),a6    ;a6 = Graphics base.
  100.     CALL    DisownBlitter    ;>> = Disown the blitter.
  101.     CALL    WaitBlit
  102.     bsr.s    .debug    ;>> = Now we can send the messaage.
  103.     move.l    _GFXBase(pc),a6    ;a6 = Graphics base.
  104.     CALL    OwnBlitter
  105.     CALL    WaitBlit
  106.     MOVEM.L    (SP)+,D0-D1/A0-A1/A6    ;SP = Return registers.
  107.     clr.w    InDebug
  108.     rts
  109.  
  110. ;-----------------------------------------------------------------------------------;
  111.  
  112. .debug    MOVEM.L    A0-A6/D0-D7,-(SP)    ;SP = Save used registers.
  113.     move.l    _SysBase,a6    ;a6 = Exec Base.
  114.     CALL    Forbid    ;>> = Halt all tasks for a moment.
  115.  
  116.     move.l    d7,d6    ;d6 = Save flags.
  117.     and.l    #$0000ffff,d7    ;d7 = Get rid of special flags.
  118.     bsr    Stepper    ;>> = Function stepper (print step).
  119.     lea    _DebugList(pc),a6    ;a6 = Pointer to debug list.
  120.     mulu    #DL_SIZEOF,d7    ;d7 = (Type)*DL_SIZEOF
  121.     move.l    DL_Print(a6,d7.l),a6    ;a6 = Printer for this type.
  122.     jsr    (a6)    ;>> = Go to the printer.
  123.     bsr    NewLine    ;>> = Write new line.
  124.  
  125.     and.l    #STEP,d6    ;d6 = Step necessary?
  126.     beq.s    .done    ;>> = Nope.
  127.     move.l    _DPKBase,a6    ;a6 = DPKBase.
  128.     CALL    FindDPKTask    ;>> = Find this task.
  129.     tst.l    d0    ;d0 = Check if the node exists.
  130.     beq.s    .done    ;>> = No.
  131.     move.l    d0,a0    ;a0 = Pointer to Task node.
  132.     addq.w    #1,GT_DebugStep(a0)    ;a0 = (DebugStep)+1
  133.  
  134. .done    move.l    _SysBase,a6    ;a6 = Exec Base.
  135.     CALL    Permit    ;>> = Give back multi-tasking.
  136.     MOVEM.L    (SP)+,A0-A6/D0-D7    ;SP = Return used registers.
  137.     clr.w    InDebug
  138.     rts
  139.  
  140. ;===================================================================================;
  141. ;                             INTERCEPT ERROR MESSAGE
  142. ;===================================================================================;
  143. ;Function: Receives an error number and prints it out.
  144. ;Requires: d0.l = Error code.
  145. ;Returns:  Nothing.
  146.  
  147. _libErrorMessage:
  148.     tst.w    InDebug
  149.     beq.s    .cont
  150.     rts
  151.  
  152. .cont    move.w    #1,InDebug
  153.     cmp.l    #ERR_END,d0    ;d0 = If (Code < 0) or (Code > ERR_END-1).
  154.     bcc.s    .exit    ;>> = Error/Unrecognised.
  155.     tst.w    gb_BlitterUsed(a6)    ;Has the blitter been grabbed and not
  156.     beq.s    .message    ;returned?  If so we better free it before
  157.     MOVEM.L    D0-D7/A0-A6,-(SP)    ;SP = Save used registers.
  158.     move.l    _GFXBase,a6    ;a6 = Graphics base.
  159.     CALL    DisownBlitter    ;>> = Disown the blitter.
  160.     bsr.s    .message    ;>> = Print message.
  161.     move.l    _GFXBase,a6    ;a6 = Graphics base.
  162.     CALL    OwnBlitter    ;>> = Get back blitter.
  163.     MOVEM.L    (SP)+,D0-D7/A0-A6    ;SP = Return used registers.
  164. .exit    clr.w    InDebug
  165.     rts
  166.  
  167. .message
  168.     MOVEM.L    A0-A6/D0-D7,-(SP)    ;SP = Save used registers.
  169.     move.l    _SysBase,a6    ;a6 = Exec Base.
  170.     CALL    Forbid    ;>> = Halt all tasks for a moment.
  171.     bsr    Stepper    ;>> = Function stepper.
  172.     lea    TXT_ErrorCode(pc),a0    ;a0 = "ErrorCode:"
  173.     bsr    WriteBold    ;>> = Write it out.
  174.     lea    ErrorList(pc),a0    ;a0 = Pointer to debug list.
  175.     add.l    d0,d0    ;d0 = *2
  176.     add.l    d0,d0    ;d0 = *4
  177.     move.l    (a0,d0.l),a0    ;a0 = Text for this type.
  178.     bsr    WText    ;>> = Write it out.
  179.     bsr    NewLine    ;>> = Write new line.
  180.     move.l    _SysBase,a6    ;a6 = Exec Base.
  181.     CALL    Permit    ;>> = Give back multi-tasking.
  182.     MOVEM.L    (SP)+,A0-A6/D0-D7    ;SP = Return used registers.
  183.     clr.w    InDebug
  184.     rts
  185.  
  186. ;===================================================================================;
  187. ;                           STEP BACK AN ENTRY
  188. ;===================================================================================;
  189. ;Function: Used to step back an entry after STEP has been specified.
  190. ;Requires: Nothing.
  191. ;Returns:  Nothing.
  192.  
  193. _libStepBack:
  194.     MOVEM.L    A0/D0,-(SP)    ;SP = Save used registers.
  195.     CALL    FindDPKTask    ;>> = Find this task.
  196.     tst.l    d0
  197.     beq.s    .done
  198.     move.l    d0,a0    ;a0 = Task node pointer.
  199.     subq.w    #1,GT_DebugStep(a0)    ;a0 = (DebugStep)-1
  200. .done    MOVEM.L    (SP)+,A0/D0    ;SP = Return used registers.
  201.     rts
  202.  
  203. ;===================================================================================;
  204. ;                            FUNCTION STEPPER
  205. ;===================================================================================;
  206.  
  207. Stepper:
  208.     MOVEM.L    D0-D7/A0-A6,-(SP)    ;SP = Save used registers.
  209.     move.l    _DPKBase,a6    ;a6 = DPKBase
  210.     CALL    FindDPKTask    ;>> = Find this task.
  211.     tst.l    d0    ;d0 = Check if node exists.
  212.     beq.s    .done    ;>> = No, exit...
  213.     move.l    d0,a0    ;a0 = Task node.
  214.  
  215.     move.w    GT_DebugStep(a0),d4    ;d4 = Amount of spaces to step.
  216.     beq.s    .done    ;>> = No spaces, exit.
  217.     blt.s    .error    ;>> = Error...
  218.  
  219.     move.l    _DOSBase,a6    ;a6 = DOSBase.
  220.     subq.w    #1,d4    ;d4 = (Step)-1 [for loop]
  221. .loop    move.l    _conhandle,d1    ;d1 = Window to output Text.
  222.     move.l    #TXT_Space,d2    ;d2 = Start of string.
  223.     moveq    #1,d3    ;d3 = One character.
  224.     bsr    IceWrite    ;>> = Write out the string.
  225.     dbra    d4,.loop    ;d4 = --1 and loop.
  226. .done    MOVEM.L    (SP)+,D0-D7/A0-A6    ;SP = Return used registers.
  227.     rts
  228.  
  229. .error    move.l    _DOSBase,a6    ;a6 = DOSBase.
  230.     move.l    _conhandle,d1    ;d1 = Window to output Text.
  231.     move.l    #.XXX,d2    ;d2 = Start of string.
  232.     moveq    #1,d3    ;d3 = One character.
  233.     bsr    IceWrite    ;>> = Write out the string.
  234.     MOVEM.L    (SP)+,D0-D7/A0-A6    ;SP = Return used registers.
  235.     rts
  236.  
  237. .XXX    dc.b    "X"
  238.     even
  239.  
  240. ;===================================================================================;
  241. ;                                PRINTING FUNCTIONS
  242. ;===================================================================================;
  243.  
  244. PRINT_Error:
  245.     lea    TXT_Error(pc),a0
  246.     bsr    WriteBold
  247.     move.l    a5,a0    ;a0 = Message
  248.     bsr    WText    ;>> = Write it out.
  249.     rts
  250.  
  251. PRINT_Formatted:
  252.     lea    TXT_Formatted(pc),a0
  253.     bsr    WriteBold
  254.     move.l    a5,a0    ;a0 = Message
  255.     bsr    WText    ;>> = Write it out.
  256.     rts
  257.  
  258. PRINT_BoldMessage:
  259.     lea    TXT_Message(pc),a0
  260.     bsr    WriteBold
  261.     move.l    a5,a0    ;a0 = Message
  262.     bsr    WText    ;>> = Write it out.
  263.     rts
  264.  
  265. PRINT_Message:
  266.     lea    TXT_Message(pc),a0
  267.     bsr    WriteFirst
  268.     move.l    a5,a0    ;a0 = Message
  269.     bsr    WText    ;>> = Write it out.
  270.     rts
  271.  
  272.  
  273. PRINT_BadNumber:
  274.     lea    TXT_BadNumber(pc),a0
  275.     bsr    WriteFirst
  276.     move.l    d5,d0
  277.     bsr    WriteDec
  278.     rts
  279.  
  280. ;-----------------------------------------------------------------------------------;
  281. ;                             MISCELLANEOUS FUNCTIONS
  282. ;-----------------------------------------------------------------------------------;
  283.  
  284. PRINT_AddInputHandler:
  285.     lea    TXT_AddInputHandler(pc),a0
  286.     bsr    WriteFirst
  287.     rts
  288.  
  289. PRINT_RemInputHandler:
  290.     lea    TXT_RemInputHandler(pc),a0
  291.     bsr    WriteFirst
  292.     rts
  293.  
  294. PRINT_Switch:
  295.     lea    TXT_Switch(pc),a0
  296.     bsr    WriteFirst
  297.     rts
  298.  
  299. PRINT_FindDPKTask:
  300.     lea    TXT_FindDPKTask(pc),a0
  301.     bsr    WriteFirst
  302.     rts
  303.  
  304. PRINT_AllocAudio:
  305.     lea    TXT_AllocAudio(pc),a0
  306.     bsr    WriteFirst
  307.     rts
  308.  
  309. PRINT_FreeAudio:
  310.     lea    TXT_FreeAudio(pc),a0
  311.     bsr    WriteFirst
  312.     rts
  313.  
  314. PRINT_DPKOpened:
  315.     lea    TXT_DPKOpened(pc),a0
  316.     bsr    WriteWhite
  317.     rts
  318.  
  319. PRINT_DPKClosed:
  320.     lea    TXT_DPKClosed(pc),a0
  321.     bsr    WriteWhite
  322.     rts
  323.  
  324. PRINT_SelfDestruct:
  325.     lea    TXT_SelfDestruct(pc),a0
  326.     bra    WriteFirst
  327.  
  328. PRINT_Armageddon:
  329.     lea    TXT_Armageddon(pc),a0
  330.     bra    WriteFirst
  331.  
  332. PRINT_FingerOfDeath:
  333.     lea    TXT_FingerOfDeath(pc),a0
  334.     bra    WriteFirst
  335.  
  336. PRINT_InitDestruct:
  337.     lea    TXT_InitDestruct(pc),a0
  338.     bra    WriteFirst
  339.  
  340. PRINT_Awaken:
  341.     lea    TXT_Awaken(pc),a0
  342.     bsr    WriteFirst
  343.     lea    TXT_Task(pc),a0
  344.     bsr    WriteText
  345.     move.l    a1,d0
  346.     bra    WriteAddress
  347.  
  348. ;-----------------------------------------------------------------------------------;
  349. ;                                BLITTER FUNCTIONS
  350. ;-----------------------------------------------------------------------------------;
  351.  
  352. PRINT_AllocBlitter:
  353.     lea    TXT_AllocBlitter(pc),a0
  354.     bra    WriteFirst
  355.  
  356. PRINT_FreeBlitter:
  357.     lea    TXT_FreeBlitter(pc),a0
  358.     bra    WriteFirst
  359.  
  360.  
  361. PRINT_CreateMasks:
  362.     lea    TXT_CreateMasks(pc),a0
  363.     bsr    WriteFirst
  364.     rts
  365.  
  366. PRINT_SetBobFrames:
  367.     lea    TXT_SetBobFrames(pc),a0
  368.     bsr    WriteFirst
  369.     rts
  370.  
  371. ;-----------------------------------------------------------------------------------;
  372. ;                                 SCREEN HANDLING
  373. ;-----------------------------------------------------------------------------------;
  374.  
  375. PRINT_MoveToBack:
  376.     move.l    a0,a1
  377.     lea    TXT_MoveToBack(pc),a0
  378.     bsr    WriteFirst
  379.     lea    TXT_ScreenAddr(pc),a0    ;a0 = "GameScreen: "
  380.     bsr    WriteText
  381.     move.l    a1,d0
  382.     bra    WriteAddress
  383.  
  384. PRINT_MoveToFront:
  385.     move.l    a0,a1
  386.     lea    TXT_MoveToFront(pc),a0
  387.     bsr    WriteFirst
  388.     lea    TXT_ScreenAddr(pc),a0    ;a0 = "GameScreen: "
  389.     bsr    WriteText
  390.     move.l    a1,d0
  391.     bra    WriteAddress
  392.  
  393. PRINT_TakeDisplay:
  394.     move.l    a0,a1
  395.     lea    TXT_TakeDisplay(pc),a0
  396.     bsr    WriteFirst
  397.     lea    TXT_ScreenAddr(pc),a0    ;a0 = "GameScreen: "
  398.     bsr    WriteText
  399.     move.l    a1,d0
  400.     bra    WriteAddress
  401.  
  402. PRINT_ReturnDisplay:
  403.     move.l    a0,a1
  404.     lea    TXT_ReturnDisplay(pc),a0
  405.     bra    WriteFirst
  406.  
  407. PRINT_BlankOn:
  408.     lea    TXT_BlankOn(pc),a0
  409.     bra    WriteFirst
  410.  
  411. PRINT_BlankOff:
  412.     lea    TXT_BlankOff(pc),a0
  413.     bra    WriteFirst
  414.  
  415. ;-----------------------------------------------------------------------------------;
  416. ;                                OBJECT FUNCTIONS
  417. ;-----------------------------------------------------------------------------------;
  418.  
  419. PRINT_GetObject:
  420.     lea    TXT_GetObject(pc),a0
  421.     bsr    WriteFirst
  422.     rts
  423.  
  424. PRINT_GetObjectList:
  425.     lea    TXT_GetObjectList(pc),a0
  426.     bsr    WriteFirst
  427.     rts
  428.  
  429. ;-----------------------------------------------------------------------------------;
  430. ;                                MEMORY FUNCTIONS
  431. ;-----------------------------------------------------------------------------------;
  432.  
  433. PRINT_AllocBlitMem:
  434.     lea    TXT_AllocBlitMem(pc),a0
  435.     bsr    WriteFirst
  436.     bsr.s    Alloc
  437.     lea    TXT_MemBlit(pc),a0
  438.     bra    WriteText
  439.  
  440. PRINT_AllocVideoMem:
  441.     lea    TXT_AllocVideoMem(pc),a0
  442.     bsr    WriteFirst
  443.     bsr.s    Alloc
  444.     lea    TXT_MemVideo(pc),a0
  445.     bra    WriteText
  446.  
  447. PRINT_AllocSoundMem:
  448.     lea    TXT_AllocSoundMem(pc),a0
  449.     bsr    WriteFirst
  450.     bsr.s    Alloc
  451.     lea    TXT_MemSound(pc),a0
  452.     bra    WriteText
  453.  
  454. PRINT_AllocMemBlock:
  455.     lea    TXT_AllocMemBlock(pc),a0
  456.     bsr    WriteFirst
  457.     bsr.s    Alloc
  458.     lea    TXT_MemData(pc),a0
  459.     bra    WriteText
  460.  
  461. PRINT_FreeMemBlock:
  462.     lea    TXT_FreeMemBlock(pc),a0
  463.     bsr    WriteFirst
  464.     lea    TXT_Address(pc),a0    ;a0 = "Address: "
  465.     bsr    WriteText    ;>> = Write it out.
  466.     bsr    WriteAddress    ;>> = Write out address in d0.
  467.     lea    TXT_Size(pc),a0    ;a0 = "Size : "
  468.     bsr    WriteText    ;>> = Write it out.
  469.     move.l    d0,a0    ;d0 = Address of memory block.
  470.     move.l    -12(a0),d0    ;d0 = Size of block.
  471.     bra    WriteDec    ;>> = Write it out.
  472.  
  473. Alloc:    lea    TXT_Size(pc),a0    ;a0 = "Size: "
  474.     bsr    WriteText    ;>> = Write text.
  475.     bra    WriteDec    ;>> = Write out size in d0.
  476.  
  477. ;-----------------------------------------------------------------------------------;
  478. ;                             STRUCTURE MANIPULATION
  479. ;-----------------------------------------------------------------------------------;
  480. ;a0 = APTR {Object}|{Tags};
  481. ;a1 = APTR Container;
  482.  
  483. PRINT_Init:
  484.     move.l    a0,a2    ;a2 = Object.
  485.     move.l    a1,a3    ;a3 = Container.
  486.     lea    TXT_Init(pc),a0    ;a0 = "Init()"
  487.     bsr    WriteFirst    ;>> = Write it out.
  488.  
  489.     move.w    (a2),d0    ;d0 = Object ID.
  490.     cmp.w    #ID_LIST,d0    ;d0 = Check for list.
  491.     bne.s    .chkSTags    ;>> = Not a list.
  492.     lea    TXT_List(pc),a0    ;a0 = "List"
  493.     bsr    WriteText    ;>> = Write.
  494.     bra.s    .colon    ;>> = Continue on.
  495.  
  496. .chkSTags
  497.     cmp.w    #ID_SPCTAGS,d0    ;d0 = Check for tags.
  498.     bne.s    .print    ;>> = Not tags.
  499.     move.w    2(a2),d0    ;d0 = Get Object ID.
  500.  
  501. .print    bsr    PrintObject    ;>> = Print the name of the object.
  502.     tst.l    d0    ;d0 = Check for recognition.
  503.     bne.s    .error    ;>> = No, error.
  504.  
  505. .colon    lea    TXT_Colon(pc),a0    ;a0 = ": "
  506.     bsr    WriteText    ;>> = Write it out.
  507.     move.l    a2,d0    ;d0 = Address of object.
  508.     bsr    WriteAddress    ;>> = Write it out.
  509.  
  510.     ;Write the container details.
  511.  
  512.     cmp.l    #$00,a3
  513.     beq.s    .done
  514.     move.w    (a3),d0    ;d0 = Container ID.
  515.     bsr    PrintObject    ;
  516.     tst.l    d0    ;
  517.     bne.s    .error    ;
  518.     lea    TXT_Colon(pc),a0    ;a0 = ": "
  519.     bsr    WriteText    ;>> = Write it out.
  520.     move.l    a3,d0    ;d0 = Address of object.
  521.     bsr    WriteAddress    ;>> = Write it out.
  522. .done
  523. .error    rts
  524.  
  525. TXT_Colon:
  526.     dc.w    ": ",0
  527.     even
  528.  
  529. ;-----------------------------------------------------------------------------------;
  530. ;                           PRINT NAME OF ANY SYSOBJECT
  531. ;-----------------------------------------------------------------------------------;
  532. ;d0 = LONG ID;
  533.  
  534. PrintObject:
  535.     MOVEM.L    A0-A1/D2/A6,-(SP)
  536.     move.l    _DPKBase,a6    ;a6 = DPKBase
  537.     sub.l    a0,a0    ;a0 = NULL.
  538.     move.l    d0,d2
  539.     CALL    FindSysObject    ;>> = Find first object using ID in d0.
  540.     tst.l    d0    ;d0 = Check for error.
  541.     beq.s    .error    ;>> = Error, exit.
  542.     move.l    d0,a0    ;a0 = Pointer to SysObject.
  543.     move.l    SO_Name(a0),a0    ;a0 = Name of the object.
  544.     cmp.l    #$00,a0
  545.     beq.s    .error
  546.     bsr    WriteText    ;>> = Write it out.
  547.     MOVEM.L    (SP)+,A0-A1/D2/A6
  548.     moveq    #ERR_OK,d0    ;d0 = No errors.
  549.     rts
  550.  
  551. .error    lea    TXT_ID(pc),a0
  552.     bsr    WriteText
  553.     move.l    d2,d0
  554.     bsr    WriteDec
  555.     MOVEM.L    (SP)+,A0-A1/D2/A6
  556.     moveq    #ERR_FAILED,d0    ;d0 = Error, return failed message.
  557.     rts
  558.  
  559. ;-----------------------------------------------------------------------------------;
  560. ;                             ACTION: Load()
  561. ;-----------------------------------------------------------------------------------;
  562.  
  563. PRINT_Load:
  564.     move.l    a0,a1    ;a1 = Source structure.
  565.     move.l    d0,d2    ;d2 = Object ID.
  566.     lea    TXT_Load(pc),a0    ;a0 = "Load()"
  567.     bsr    WriteFirst    ;>> = Write.
  568.  
  569.     bsr    PrintSource    ;>> = Print source in a1.
  570.  
  571.     tst.l    d2    ;d2 = Test if ID was forced.
  572.     beq.s    .done    ;>> = Nope.
  573.     lea    TXT_Space(pc),a0    ;a0 = " "
  574.     bsr    WriteText    ;>> = Write.
  575.     move.l    d2,d0    ;d0 = Object ID.
  576.     bsr    PrintObject    ;>> = Print the name of the object.
  577. .done    rts
  578.  
  579. ;-----------------------------------------------------------------------------------;
  580. ;                           PRINT SOURCE OBJECT
  581. ;-----------------------------------------------------------------------------------;
  582. ;a1 = APTR {FileName}|{MemPtr}|{Object}
  583.  
  584. PrintSource:
  585.     MOVEM.L    A0/A1,-(SP)
  586.  
  587. .chkfilename
  588.     cmp.w    #ID_FILENAME,(a1)
  589.     bne.s    .chkmem
  590.     lea    TXT_FileName(pc),a0
  591.     bsr    WriteText
  592.     move.l    FN_Name(a1),a0
  593.     bsr    WriteText
  594.     MOVEM.L    (SP)+,A0/A1
  595.     moveq    #ERR_OK,d0
  596.     rts
  597.  
  598. .chkmem    cmp.w    #ID_MEMPTR,(a1)
  599.     bne.s    .chkfile
  600.     lea    TXT_Source(pc),a0
  601.     bsr    WriteText
  602.     move.l    MPTR_Address(a1),d0
  603.     bsr    WriteHex
  604.     MOVEM.L    (SP)+,A0/A1
  605.     moveq    #ERR_OK,d0
  606.     rts
  607.  
  608. .chkfile
  609.     cmp.w    #ID_FILE,(a1)
  610.     bne.s    .error
  611.     lea    TXT_File(pc),a0
  612.     bsr    WriteText
  613.     move.l    FL_Source(a1),a0
  614.     move.l    FN_Name(a0),a0
  615.     bsr    WriteText
  616.     MOVEM.L    (SP)+,A0/A1
  617.     moveq    #ERR_OK,d0
  618.     rts
  619.  
  620. .error    MOVEM.L    (SP)+,A0/A1
  621.     moveq    #ERR_FAILED,d0
  622.     rts
  623.  
  624. ;-----------------------------------------------------------------------------------;
  625. ;                                  ACTION: Hide()
  626. ;-----------------------------------------------------------------------------------;
  627.  
  628. PRINT_Hide:
  629.     move.l    a0,a1    ;a1 = Save structure.
  630.     lea    TXT_Hide(pc),a0    ;a0 = Hide()
  631.     bsr    WriteFirst    ;>> = Write.
  632.     bra    PrintDetails
  633.  
  634. ;-----------------------------------------------------------------------------------;
  635. ;                                 ACTION: Display()
  636. ;-----------------------------------------------------------------------------------;
  637.  
  638. PRINT_Display:
  639.     move.l    a0,a1    ;a1 = Save structure.
  640.     lea    TXT_Display(pc),a0    ;a0 = Display()
  641.     bsr    WriteFirst    ;>> = Write.
  642.     bra    PrintDetails
  643.  
  644. ;-----------------------------------------------------------------------------------;
  645. ;                                 ACTION: Get()
  646. ;-----------------------------------------------------------------------------------;
  647. ;d0 = LONG ID;
  648.  
  649. PRINT_Get:
  650.     lea    TXT_Get(pc),a0
  651.     bsr    WriteFirst
  652.     bsr    PrintObject
  653.     rts
  654.  
  655. ;-----------------------------------------------------------------------------------;
  656. ;                         ACTION: CopyStructure()
  657. ;-----------------------------------------------------------------------------------;
  658.  
  659. PRINT_CopyStructure:
  660.     lea    TXT_CopyStructure(pc),a0
  661.     bsr    WriteFirst
  662.     rts
  663.  
  664. ;-----------------------------------------------------------------------------------;
  665. ;                                 ACTION: Free()
  666. ;-----------------------------------------------------------------------------------;
  667. ;a0 = APTR Object;
  668.  
  669. PRINT_Free:
  670.     move.l    a0,a1    ;a1 = Save structure.
  671.     lea    TXT_Free(pc),a0    ;a0 = Free()
  672.     bsr    WriteFirst    ;>> = Write.
  673.     cmp.l    #$00,a1    ;a1 = Check for NULL.
  674.     bne.s    PrintDetails
  675.     rts
  676.  
  677. PrintDetails:
  678. .chkList
  679.     cmp.w    #ID_LIST,(a1)
  680.     bne.s    .chkGTags
  681.     lea    TXT_List(pc),a0
  682.     bra.s    .write
  683.  
  684. .chkGTags
  685.     cmp.w    #ID_GENTAGS,(a1)
  686.     bne.s    .chkSTags
  687.     lea    TXT_Tags(pc),a0
  688.     bra.s    .write
  689.  
  690. .chkSTags
  691.     cmp.w    #ID_SPCTAGS,(a1)
  692.     bne.s    .chkStruct
  693.     lea    TXT_Tags(pc),a0
  694.     bra.s    .write
  695.  
  696. .chkStruct
  697.     move.l    _DPKBase,a6
  698.     moveq    #$00,d0
  699.     move.w    (a1),d0
  700.     sub.l    a0,a0
  701.     CALL    FindSysObject
  702.     tst.l    d0
  703.     bne.s    .sysobj
  704.     lea    TXT_InvalidObj(pc),a0
  705.     bsr    WriteText
  706.     rts
  707.  
  708. .sysobj    move.l    d0,a2
  709.     move.l    SO_Name(a2),a0    ;a0 = Name of the object.
  710. .write    bsr    WriteText    ;>> = Write out the name, eg "Picture".
  711.     lea    TXT_Colon,a0    ;a0 = ": "
  712.     bsr    WriteText    ;>> = Write.
  713.     move.l    a1,d0    ;d0 = Structure address.
  714.     bra    WriteAddress
  715.  
  716. TXT_List:
  717.     dc.b    "List",0
  718.     even
  719.  
  720. TXT_Tags:
  721.     dc.b    "Tags",0
  722.     even
  723.  
  724. ;-----------------------------------------------------------------------------------;
  725.  
  726. PRINT_Dead:
  727.     rts
  728.  
  729. ;-----------------------------------------------------------------------------------;
  730. ;                                    FILE I/O
  731. ;-----------------------------------------------------------------------------------;
  732.  
  733. PRINT_OpenFile:
  734.     move.l    a0,a1    ;a1 = Source structure.
  735.     move.l    d0,d2    ;d2 = Object ID.
  736.     lea    TXT_OpenFile(pc),a0    ;a0 = "Load()"
  737.     bsr    WriteFirst    ;>> = Write.
  738.     bsr    PrintSource    ;>> = Print source in a1.
  739.  
  740.     lea    TXT_Flags(pc),a0    ;a0 = ", Flags: $"
  741.     bsr.s    WriteText
  742.     move.l    d2,d0
  743.     bsr    WriteHex    ;>> = Write out hex flags in d0.
  744.     rts
  745.  
  746. ;===================================================================================;
  747. ;                                NEW LINE
  748. ;===================================================================================;
  749.  
  750. NewLine:
  751.     MOVEM.L    D0-D7/A0-A6,-(SP)    ;SP = Save used registers.
  752.     move.l    _DOSBase,a6    ;a6 = DOSBase.
  753.     move.l    _conhandle,d1    ;d1 = Window to output Text.
  754.     move.l    #TXT_NewLine,d2    ;d2 = Start of string.
  755.     moveq    #1,d3    ;d3 = One character.
  756.     bsr    IceWrite    ;>> = Write out the string.
  757.     MOVEM.L    (SP)+,D0-D7/A0-A6    ;SP = Return used registers.
  758.     rts
  759.  
  760. ;===================================================================================;
  761. ;                            OUTPUT Text TO OUR WINDOW
  762. ;===================================================================================;
  763. ;Internal: Writes a string of Text to our window.
  764. ;Requires: a0 = Text string.
  765. ;Returns:  Nothing.
  766.  
  767. MAXLETTERS =    23
  768.  
  769. WriteBold:
  770.     MOVEM.L    A0-A6/D0-D7,-(SP)    ;SP = Save used registers.
  771.     move.l    a0,a3    ;a3 = Save pointer to text to write.
  772.     move.l    _DOSBase,a6    ;a6 = DOSBase.
  773.     move.l    _conhandle,d1    ;d1 = Window to output Text.
  774.     move.l    #TXT_Bold,d2    ;d2 = Start of string.
  775.     moveq    #4,d3    ;d3 = (EndString)-StartString [Length]
  776.     bsr    IceWrite    ;>> = Write out the string.
  777.     bra.s    WSkip
  778.  
  779. WriteWhite:
  780.     MOVEM.L    A0-A6/D0-D7,-(SP)    ;SP = Save used registers.
  781.     move.l    a0,a3    ;a3 = Save pointer to text to write.
  782.     move.l    _DOSBase,a6    ;a6 = DOSBase.
  783.     move.l    _conhandle,d1    ;d1 = Window to output Text.
  784.     move.l    #TXT_White,d2    ;d2 = Start of string.
  785.     moveq    #5,d3    ;d3 = (EndString)-StartString [Length]
  786.     bsr    IceWrite    ;>> = Write out the string.
  787.     bra.s    WSkip    ;>> = Skip into routine.
  788.  
  789. WriteFirst:
  790.     MOVEM.L    A0-A6/D0-D7,-(SP)    ;SP = Save used registers.
  791.     move.l    a0,a3    ;a3 = Save pointer to text to write.
  792.     move.l    _DOSBase,a6    ;a6 = DOSBase.
  793.     move.l    _conhandle,d1    ;d1 = Window to output Text.
  794.     move.l    #TXT_Flat,d2    ;d2 = Start of string.
  795.     moveq    #4,d3    ;d3 = (EndString)-StartString [Length]
  796.     bsr    IceWrite    ;>> = Write out the string.
  797.  
  798. WSkip:    move.l    _DPKBase,a6    ;a6 = DPKBase.
  799.     move.l    _conhandle,d1    ;d1 = Window to output Text.
  800.     move.l    a3,d2    ;d2 = Start of string.
  801.     moveq    #-1,d3    ;d3 = -1 [length]
  802. .count    addq.l    #1,d3    ;d3 = ++1
  803.     tst.b    (a3)+    ;a3 = End of string?
  804.     bne.s    .count    ;>> = Keep looping.
  805.  
  806.     moveq    #MAXLETTERS,d5    ;d5 = MaxLetters
  807.     sub.l    d3,d5    ;d5 = (MaxLetters)-TextLength
  808.  
  809.     move.l    _DPKBase,a6
  810.     CALL    FindDPKTask
  811.     tst.l    d0
  812.     beq.s    .under
  813.     move.l    d0,a0    ;a0 = DPK Task.
  814.  
  815.     moveq    #$00,d6
  816.     move.w    GT_DebugStep(a0),d6
  817.     sub.l    d6,d5    ;d5 = (MaxLetters-TextLength)-Stepped
  818.     bge.s    .under    ;>> = Under the maximum amount.
  819.     add.l    d5,d3    ;d3 = (Length)-Overflow
  820. .under    bsr    IceWrite    ;>> = Write out the string.
  821.  
  822. .spaces    subq.l    #1,d5
  823.     ble.s    .done
  824.     move.l    _conhandle,d1    ;d1 = Output.
  825.     move.l    #TXT_Space,d2    ;d2 = Start of text.
  826.     moveq    #1,d3    ;d3 = 1 character.
  827.     bsr    IceWrite    ;>> = Write out the string.
  828.     bra.s    .spaces    ;>> = Loop until finished.
  829. .done    MOVEM.L    (SP)+,A0-A6/D0-D7    ;SP = Return used registers.
  830.     rts
  831.  
  832. ;-----------------------------------------------------------------------------------;
  833.  
  834. WriteText:
  835.     MOVEM.L    A0-A6/D0-D7,-(SP)    ;SP = Save used registers.
  836.     move.l    _DOSBase,a6    ;a6 = DOSBase.
  837.     move.l    _conhandle,d1    ;d1 = Window to output Text.
  838.     move.l    #TXT_Flat,d2    ;d2 = Start of string.
  839.     moveq    #4,d3    ;d3 = (EndString)-StartString [Length]
  840.     bsr    IceWrite    ;>> = Write out the string.
  841.     MOVEM.L    (SP)+,A0-A6/D0-D7    ;SP = Return used registers.
  842.     bsr.s    WText
  843.     rts
  844.  
  845. ;-----------------------------------------------------------------------------------;
  846. ;a0 = String to write.
  847.  
  848. WText:    MOVEM.L    A0-A6/D0-D7,-(SP)    ;SP = Save used registers.
  849.     move.l    _DOSBase,a6    ;a6 = DOSBase.
  850.     move.l    _conhandle,d1    ;d1 = Window to output Text.
  851.     move.l    a0,d2    ;d2 = Start of string.
  852. .count    tst.b    (a0)+    ;a0 = End of string?
  853.     bne.s    .count    ;>> = Keep looping.
  854.     subq.w    #1,a0    ;a0 = --1 [End of string]
  855.     move.l    a0,d3    ;d3 = End of string.
  856.     sub.l    d2,d3    ;d3 = (EndString)-StartString [Length]
  857.     cmp.l    #80,d3
  858.     bcc.s    .done
  859.     bsr    IceWrite    ;>> = Write out the string.
  860. .done    MOVEM.L    (SP)+,A0-A6/D0-D7    ;SP = Return used registers.
  861.     rts
  862.  
  863.  
  864. ;===================================================================================;
  865. ;                              WRITE ADDRESS
  866. ;===================================================================================;
  867. ;d0 = Address to write.
  868.  
  869. WriteAddress:
  870.     MOVEM.L    A0-A6/D0-D7,-(SP)    ;SP = Save used registers.
  871.     lea    TXT_Hex(pc),a0    ;a0 = "$"
  872.     bsr    WriteText    ;>> = Write it out.
  873.     bsr    WriteHex    ;>> = Write the supplied address.
  874.  
  875.     ;bsr    WriteDec    ;>> = Write the supplied address as decimal.
  876.     MOVEM.L    (SP)+,A0-A6/D0-D7    ;SP = Save used registers.
  877.     rts
  878.  
  879. TXT_Hex: dc.b    "$",0
  880.      even
  881.  
  882. ;===================================================================================;
  883. ;                      OUTPUT HEXADECIMAL Text TO OUR WINDOW
  884. ;===================================================================================;
  885. ;Internal: Outputs a longword value as hexidecimal Text.
  886. ;Requires: d0 = Value
  887. ;Returns:  Nothing.
  888.  
  889. WriteHex:
  890.     MOVEM.L    A0-A6/D0-D7,-(SP)    ;SP = Save used registers.
  891.     lea    .hex(pc),a0    ;a0 = Hex table.
  892.     lea    String(pc),a1    ;a1 = Text buffer.
  893.     moveq    #$00,d2
  894.     tst.l    d0
  895.     beq.s    .wzero
  896.     moveq    #8-1,d7    ;d7 = (AmtBytes)-1
  897. .loop2    rol.l    #4,d0    ;d0 = <<4 [rotate, last nibble first]
  898.     move.l    d0,d1    ;d1 = Current value.
  899.     and.l    #$0000000F,d1    ;d1 = (Value)&$F [nibble]
  900.     bne.s    .write
  901.     tst.w    d2
  902.     beq.s    .skip
  903. .write    move.b    (a0,d1.w),(a1)+    ;a1 = Write out the hex value.
  904.     moveq    #$01,d2
  905. .skip    dbra    d7,.loop2    ;d7 = --1 and loop.
  906.     move.w    #$2000,(a1)    ;a1 = Clear the final byte.
  907.     lea    String(pc),a0    ;a0 = Text buffer.
  908.     bsr    WriteText    ;>> = Write it out.
  909.     MOVEM.L    (SP)+,A0-A6/D0-D7    ;SP = Return used registers.
  910.     rts
  911.  
  912. .wzero    lea    .zero(pc),a0    ;a0 = "0"
  913.     bsr    WriteText    ;>> = Write it out.
  914.     MOVEM.L    (SP)+,A0-A6/D0-D7    ;SP = Return used registers.
  915.     rts
  916.  
  917. .zero    dc.b    "0 ",0
  918.     even
  919.  
  920. .hex    dc.b    "0123456789ABCDEF"
  921.     even
  922.  
  923. String:    dc.b    "                ",0
  924.     even
  925.  
  926. ;===================================================================================;
  927. ;                             WRITE DECIMAL NUMBER
  928. ;===================================================================================;
  929. ;Internal: Outputs a longword value as decimal Text.
  930. ;Requires: d0 = Value
  931. ;       d7 = AmtBytes (1-8) or -1/0.
  932. ;Returns:  Nothing.
  933.  
  934. WriteDec:
  935.     MOVEM.L    A0-A6/D0-D7,-(SP)    ;SP = Save used registers.
  936.     moveq    #-1,d7
  937.     move.l    _DPKBase,a6
  938.     move.w    d7,d1
  939.     lea    String(pc),a0
  940.     bsr    _WriteDec
  941.     move.l    d0,a1
  942.     move.w    #$2000,(a1)
  943.     bsr    WriteText
  944.     MOVEM.L    (SP)+,A0-A6/D0-D7    ;SP = Return used registers.
  945.     rts
  946.  
  947. ;===================================================================================;
  948. ;                     OUTPUT A VALUE AS A DECIMAL-TEXT NUMBER
  949. ;===================================================================================;
  950. ;Function: Write a value out as a decimal number.
  951. ;Requires: d0 = LONG Value;
  952. ;       d1 = WORD Amount of digits or NULL for dynamic association;
  953. ;       a0 = APTR Text destination;
  954. ;Returns:  d0 = APTR End address of written numbers;
  955.  
  956. _WriteDec:
  957.     MOVEM.L    D1-D3/A0-A1,-(SP)    ;SP = Save used registers.
  958.     tst.w    d1    ;d1 = Check if he knows the amt of digits.
  959.     bgt.s    .Convert    ;>> = He knows, convert the number.
  960.  
  961. .CountDigits
  962.     moveq    #1,d1    ;d1 = At least 1 digit.
  963.     moveq    #10,d2    ;d2 = 10.
  964.     lea    .dec-4(pc),a1    ;a1 = Decimal table (powers of 10).
  965. .floop    cmp.l    (a1),d0    ;d0 = Is (Number < 10)?
  966.     blt.s    .Convert    ;>> = Yes, convert.
  967.     subq.w    #4,a1    ;d2 = (10*10) = 100
  968.     addq.w    #1,d1    ;d1 = ++1, extra digit required.
  969.     bra.s    .floop    ;>> = Keep looping.
  970.  
  971. .Convert
  972.     tst.l    d0    ;d0 = Check.
  973.     bge.s    .pos    ;>> = Number is positive.
  974.     move.b    #"-",(a0)+    ;a0 = User now knows it is negative.
  975.     neg.l    d0    ;d0 = Make it positive.
  976. .pos    subq.w    #1,d1    ;d1 = --1 for loop.
  977.     move.w    d1,d2    ;d2 = (AmtDigits)-1.
  978.     add.w    d2,d2    ;d2 = (AmtDigits-1)*2
  979.     add.w    d2,d2    ;d2 = (AmtDigits-1)*4 [long]
  980.     neg.w    d2    ;d2 = -((AmtDigits-1)*4)
  981.     lea    .dec(pc,d2.w),a1    ;a1 = List of neggers
  982. .loop    move.l    (a1)+,d2    ;d2 = Get negger
  983.     moveq    #'0',d3    ;d3 = This digit ($30)
  984. .iloop    sub.l    d2,d0
  985.     bmi.s    .digdun
  986.     addq.b    #1,d3    ;d3 = Build digit
  987.     bra.s    .iloop
  988. .digdun    add.l    d2,d0
  989.     move.b    d3,(a0)+
  990.     dbra    d1,.loop
  991.     move.l    a0,d0    ;d0 = Address finished writing to.
  992.     MOVEM.L    (SP)+,D1-D3/A0-A1
  993.     rts
  994.  
  995.     dc.l    1000000000
  996.     dc.l    0100000000
  997.     dc.l    0010000000
  998.     dc.l    0001000000
  999.     dc.l    0000100000
  1000.     dc.l    0000010000
  1001.     dc.l    0000001000
  1002.     dc.l    0000000100
  1003.     dc.l    0000000010
  1004. .dec    dc.l    0000000001
  1005.  
  1006. ;===================================================================================;
  1007. ;                                  SAFE WRITE
  1008. ;===================================================================================;
  1009.  
  1010. IceWrite:
  1011.     MOVEM.L    D0-D7/A0-A6,-(SP)
  1012.     move.l    _DOSBase,a6
  1013.     cmp.l    #100,d3
  1014.     bcc.s    .error
  1015.     CALL    dosWrite
  1016.     MOVEM.L    (SP)+,D0-D7/A0-A6
  1017.     rts
  1018.  
  1019. .error    move.l    #.message,d2
  1020.     move.l    #.messlen,d3
  1021.     CALL    Write
  1022.     MOVEM.L    (SP)+,D0-D7/A0-A6
  1023.     rts
  1024.  
  1025. .message
  1026.     dc.b    "IceBreaker:  Error in string length.",0
  1027. .messlen =    *-.message-1
  1028.     even
  1029.  
  1030. ;===================================================================================;
  1031. ;                             Text FOR PRINT ROUTINES
  1032. ;===================================================================================;
  1033.  
  1034. _maxstep:  dc.w  2
  1035. _GFXBase:  dc.l  0
  1036. _DPKBase:  dc.l  0
  1037. InDebug:   dc.w  0
  1038.  
  1039. TXT_Address:      WText "Address: "
  1040. TXT_Allocated:      WText "Allocated.  "
  1041. TXT_AmtBuffers:      WText "AmtBuffers: "
  1042. TXT_AmtEntries:      WText ", AmtEntries: "
  1043. TXT_CDest:      WText ", Dest: "
  1044. TXT_CSource:      WText ", Source: "
  1045. TXT_File:      WText "File: "
  1046. TXT_FileName:      WText "FileName: "
  1047. TXT_FileBase:      WText "FileBase: "
  1048. TXT_Flags:      WText ", Flags: $"
  1049. TXT_ID:          WText "ID: "
  1050. TXT_InvalidObj:   WText "Invalid object detected."
  1051. TXT_MemData:      WText "(Data)"
  1052. TXT_MemVideo:      WText "(Video)"
  1053. TXT_MemBlit:      WText "(Blit)"
  1054. TXT_MemSound:      WText "(Sound)"
  1055. TXT_Name:      WText "Name: "
  1056. TXT_NewLine:      dc.b  10,0
  1057. TXT_RasterAddr:      WText " Raster: "
  1058. TXT_RestoreAddr:  WText "Restorelist: "
  1059. TXT_SourceLen:      WText "Length: "
  1060. TXT_Source:      WText "Source: "
  1061. TXT_ScreenAddr:      WText "Screen: "
  1062. TXT_Size:      WText "Size: "
  1063. TXT_Space:      WText " "
  1064. TXT_Structure:      WText "Structure: "
  1065. TXT_Task:      WText "Task: "
  1066. TXT_Unknown:      WText "Unknown.  "
  1067. TXT_Unspecified:  WText "Unspecified.  "
  1068.  
  1069. TXT_Flat:      WText ""
  1070. TXT_Bold:      WText ""
  1071. TXT_White:      WText ""
  1072.  
  1073. ;-----------------------------------------------------------------------------------;
  1074. ;                                    ERROR LIST
  1075. ;-----------------------------------------------------------------------------------;
  1076.  
  1077. ErrorList:
  1078.     dc.l    ERROR_OK
  1079.     dc.l    ERROR_NoMem
  1080.     dc.l    ERROR_NoPtr
  1081.     dc.l    ERROR_InUse
  1082.     dc.l    ERROR_Struct
  1083.     dc.l    ERROR_Failed
  1084.     dc.l    ERROR_File
  1085.     dc.l    ERROR_Data
  1086.     dc.l    ERROR_Search
  1087.     dc.l    ERROR_ScrType
  1088.     dc.l    ERROR_Module
  1089.     dc.l    ERROR_RCommand
  1090.     dc.l    ERROR_RList
  1091.     dc.l    ERROR_NoRaster
  1092.     dc.l    ERROR_DiskFull
  1093.     dc.l    ERROR_FileMiss
  1094.     dc.l    ERROR_WrongVer
  1095.     dc.l    ERROR_Monitor
  1096.     dc.l    ERROR_Unpack
  1097.     dc.l    ERROR_Args
  1098.     dc.l    ERROR_NoData
  1099.     dc.l    ERROR_Read
  1100.     dc.l    ERROR_Write
  1101.  
  1102. ERROR_OK:    WText "OK: No problem!"
  1103. ERROR_NoMem:    WText "NOMEM: Not enough memory available."
  1104. ERROR_NoPtr:    WText "NOPTR: A required address pointer is not present."
  1105. ERROR_InUse:    WText "INUSE: Previous allocations have not been freed."
  1106. ERROR_Struct:    WText "STRUCT: Structure version not supported or found."
  1107. ERROR_Failed:    WText "FAILED: General/Miscellaneous failure."
  1108. ERROR_File:    WText "FILE: File error, eg file not found, disk full etc."
  1109. ERROR_Data:    WText "DATA: There is an error in the given data."
  1110. ERROR_Search:    WText "SEARCH: An internal search was performed and it failed."
  1111. ERROR_ScrType:    WText "SCRTYPE: Screen Type not recognised."
  1112. ERROR_Module:    WText "MODULE: Trouble initialising a system module."
  1113. ERROR_RCommand: WText "RASTCOMMAND: Invalid raster command detected."
  1114. ERROR_RList:    WText "RASTERLIST: Complete rasterlist failure."
  1115. ERROR_NoRaster: WText "NORASTER: Raster object missing from GS_Raster."
  1116. ERROR_DiskFull: WText "DISKFULL: Disk full error."
  1117. ERROR_FileMiss: WText "FILEMISSING: File not found."
  1118. ERROR_WrongVer: WText "WRONGVER: Wrong version or version not supported."
  1119. ERROR_Monitor:  WText "MONITOR: Monitor driver not found or not supported."
  1120. ERROR_Unpack:   WText "UNPACK: Problem with unpacking of data."
  1121. ERROR_Args:    WText "ARGS: Invalid arguments passed to function."
  1122. ERROR_NoData:    WText "NODATA: No data is available for use."
  1123. ERROR_Read:    WText "READ: Error reading data from file."
  1124. ERROR_Write:    WText "WRITE: Error writing data to file."
  1125.  
  1126. ;-----------------------------------------------------------------------------------;
  1127. ;                                    DEBUG LIST
  1128. ;-----------------------------------------------------------------------------------;
  1129.  
  1130.     STRUCTURE    DataListEntry,0
  1131.     WORD    DL_State    ;On = 1 / Off = 0.
  1132.     APTR    DL_Print    ;Pointer to the function printer.
  1133.     LABEL    DL_SIZEOF
  1134.  
  1135.     MACRO    Entry
  1136.     dc.w    1    ;On = 1 / Off = 0.
  1137.     dc.l    PRINT_\1    ;Print function called by WriteBuffer.
  1138.     ENDM
  1139.  
  1140. _DebugList:
  1141.     Entry    Error    ;0 
  1142.     Entry    Formatted    ;1 
  1143.     Entry    BoldMessage    ;2 
  1144.     Entry    Message    ;3
  1145.     Entry    FreeMemBlock    ;4
  1146.     Entry    Load    ;5
  1147.     Entry    CopyStructure    ;6
  1148.     Entry    AddInputHandler    ;7
  1149.     Entry    RemInputHandler    ;8
  1150.     Entry    Dead    ;9
  1151.     Entry    AllocBlitter    ;10
  1152.     Entry    FreeBlitter    ;11
  1153.     Entry    AllocBlitMem    ;12
  1154.     Entry    AllocVideoMem    ;13
  1155.     Entry    AllocSoundMem    ;14
  1156.     Entry    AllocAudio    ;15
  1157.     Entry    FreeAudio    ;16
  1158.     Entry    Dead    ;17
  1159.     Entry    Dead    ;18
  1160.     Entry    FindDPKTask    ;19
  1161.     Entry    MoveToFront    ;20
  1162.     Entry    Switch    ;21
  1163.     Entry    DPKOpened    ;22
  1164.     Entry    DPKClosed    ;23
  1165.     Entry    Dead    ;24
  1166.     Entry    Get    ;25
  1167.     Entry    SelfDestruct    ;26
  1168.     Entry    Armageddon    ;27
  1169.     Entry    FingerOfDeath    ;28
  1170.     Entry    InitDestruct    ;29
  1171.     Entry    BlankOn    ;30
  1172.     Entry    BlankOff    ;31
  1173.     Entry    GetObjectList    ;32
  1174.     Entry    GetObject    ;33
  1175.     Entry    OpenFile    ;34
  1176.     Entry    Free    ;35
  1177.     Entry    MoveToBack    ;36
  1178.     Entry    TakeDisplay    ;37
  1179.     Entry    ReturnDisplay    ;38
  1180.     Entry    Awaken    ;39
  1181.     Entry    CreateMasks    ;40
  1182.     Entry    SetBobFrames    ;41
  1183.     Entry    AllocMemBlock    ;42
  1184.     Entry    Init    ;43
  1185.     Entry    Display    ;44
  1186.     Entry    Hide    ;45
  1187.     Entry    BadNumber    ;46
  1188.  
  1189. ;---------------------------------------------------------------------------;
  1190.  
  1191. TXT_DPKOpened:        WText "PROGRAM OPENED    "
  1192. TXT_DPKClosed:        dc.b  "PROGRAM CLOSED    ",10,0
  1193.               even
  1194.  
  1195. TXT_ErrorCode:          WText "ErrorCode:"
  1196. TXT_Error:          WText "Error:"
  1197. TXT_Formatted:          WText "Message:"
  1198. TXT_Message:          WText "Message:"
  1199.  
  1200. TXT_AllocMemBlock:    WText "AllocMemBlock()"
  1201. TXT_FreeMemBlock:     WText "FreeMemBlock()"
  1202. TXT_AddInputHandler:  WText "AddInputHandler()"
  1203. TXT_RemInputHandler:  WText "RemInputHandler()"
  1204. TXT_AllocBlitter:     WText "AllocBlitter()"
  1205. TXT_FreeBlitter:      WText "FreeBlitter()"
  1206. TXT_AllocBlitMem:     WText "AllocBlitMem()"
  1207. TXT_AllocVideoMem:    WText "AllocVideoMem()"
  1208. TXT_AllocSoundMem:    WText "AllocSoundMem()"
  1209. TXT_AllocAudio:       WText "AllocAudio()"
  1210. TXT_FreeAudio:          WText "FreeAudio()"
  1211. TXT_FindDPKTask:      WText "FindTask()"
  1212. TXT_MoveToFront:      WText "MoveToFront()"
  1213. TXT_Switch:           WText "Switch()"
  1214. TXT_Get:              WText "Get()"
  1215. TXT_SelfDestruct:     WText "SelfDestruct()"
  1216. TXT_Armageddon:       WText "Armageddon()"
  1217. TXT_FingerOfDeath:    WText "FingerOfDeath()"
  1218. TXT_InitDestruct:     WText "InitDestruct()"
  1219. TXT_BlankOn:          WText "BlankOn()"
  1220. TXT_BlankOff:         WText "BlankOff()"
  1221. TXT_GetObjectList:    WText "GetObjectList()"
  1222. TXT_GetObject:        WText "GetObject()"
  1223. TXT_OpenFile:          WText "OpenFile()"
  1224. TXT_Free:             WText "Free()"
  1225. TXT_MoveToBack:       WText "MoveToBack()"
  1226. TXT_TakeDisplay:      WText "TakeDisplay()"
  1227. TXT_ReturnDisplay:    WText "ReturnDisplay()"
  1228. TXT_Awaken:          WText "Awaken()"
  1229. TXT_CreateMasks:      WText "CreateMasks()"
  1230. TXT_SetBobFrames:     WText "SetBobFrames()"
  1231. TXT_Init:             WText "Init()"
  1232. TXT_Display:          WText "Display()"
  1233. TXT_Hide:             WText "Hide()"
  1234. TXT_Load:             WText "Load()"
  1235. TXT_CopyStructure:    WText "CopyStructure()"
  1236. TXT_BadNumber:          WText "ERROR #"
  1237.  
  1238.